package com.oracle.oa.biz.impl;

import java.text.SimpleDateFormat;
import java.util.Date;

import com.oracle.oa.biz.LoginLogBiz;
import com.oracle.oa.dao.LoginLogDao;
import com.oracle.oa.dao.impl.LoginLogDaoImpl;
import com.oracle.oa.entity.Loginlog;
import com.oracle.oa.entity.Userinfo;

public class LoginLogBizImpl extends BaseBizImpl implements LoginLogBiz {

	LoginLogDao loginLogDao;
	/**
	 * 
	 * @param user  操作者Userinfo    登录的用户user
	 * @param ifsuccess  登录是否成功    1:成功  0:失败
	 */
	public void add(Userinfo user,int ifsuccess){
		/*用户名
		 * ip
		 * 时间
		 * 是否成功*/
		Loginlog loginlog=new Loginlog();
		SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		loginlog.setIfsuccess(ifsuccess);
		loginlog.setUserinfo(user);
		loginlog.setLoginuserip("127.0.0.1");
		loginlog.setLogintime(sdf.format(new Date()));
		loginLogDao.save(loginlog);
	}

	public LoginLogDao getLoginLogDao() {
		return loginLogDao;
	}

	public void setLoginLogDao(LoginLogDao loginLogDao) {
		this.loginLogDao = loginLogDao;
	}
	
	
	
	
}
